import request from '@/utils/request'

// 获取通知列表
export function getNotificationList(params) {
  return request({
    url: '/api/notifications/list',
    method: 'get',
    params
  })
}

// 获取通知详情
export function getNotificationDetail(id) {
  return request({
    url: `/api/notifications/${id}`,
    method: 'get'
  })
}

// 添加通知
export function addNotification(data) {
  return request({
    url: '/api/notifications',
    method: 'post',
    data
  })
}

// 更新通知
export function updateNotification(data) {
  return request({
    url: '/api/notifications',
    method: 'put',
    data
  })
}

// 删除通知
export function deleteNotification(id) {
  return request({
    url: `/api/notifications/${id}`,
    method: 'delete'
  })
}

// 获取未读通知数量
export function getUnreadCount() {
  return request({
    url: '/api/notifications/unread/count',
    method: 'get'
  })
}

// 标记通知为已读
export function markAsRead(id) {
  return request({
    url: `/api/notifications/read/${id}`,
    method: 'put'
  })
}

// 标记所有通知为已读
export function markAllAsRead() {
  return request({
    url: '/api/notifications/read/all',
    method: 'put'
  })
} 